﻿using Entity.WMS.DTO.WarehouseBalance;
using Entity.WMS.View.WarehouseBalance;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Service.WMS;

namespace AnQinManagermentBackendAPI.Controller.WMS
{
    /// <summary>
    /// 库存结存表
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    [Authorize]
    public class WarehouseBalanceController : ControllerBase
    {
        /**
         * 库存结存业务接口
         */
        private readonly WarehouseBalanceService _warehouseBalanceService;

        /**
         * 构造函数注入
         */
        public WarehouseBalanceController(WarehouseBalanceService warehouseBalanceService)
        {
            _warehouseBalanceService = warehouseBalanceService;
        }

        /// <summary>
        /// 获取库存结存列表
        /// </summary>
        /// <param name="warehouseBalanceSearchDTO"></param>
        [HttpGet]
        [ProducesResponseType(typeof(WarehouseBalanceView), 200)]
        public async Task<IActionResult> GetWarehouseOtherInList([FromQuery] WarehouseBalanceSearchDTO warehouseBalanceSearchDTO)
        {
            var response = await _warehouseBalanceService.GetWarehouseBalanceList(warehouseBalanceSearchDTO);
            return StatusCode(response.Status, response);
        }

        /// <summary>
        /// 获取库存结存子单列表
        /// </summary>
        /// <param name="warehouseBalanceItemSearchDTO"></param>
        [HttpGet("item")]
        [ProducesResponseType(typeof(WarehouseBalanceItemView), 200)]
        public async Task<IActionResult> GetWarehouseOtherInList([FromQuery] WarehouseBalanceItemSearchDTO warehouseBalanceItemSearchDTO)
        {
            var response = await _warehouseBalanceService.GetWarehouseBalanceItemList(warehouseBalanceItemSearchDTO);
            return StatusCode(response.Status, response);
        }
    }
}
